<template>
  <div class="q-pa-md q-gutter-sm">
    <t-advanced-editor :readonly="false" ref="editor" label="111111" :enableComment="true" v-model="test11111"></t-advanced-editor>
    <button @click="changeData">改变editor值</button>
    <button @click="getData">打印editor值</button>
    <button @click="insertHTML('<b>哈哈哈哈哈</b>')">插入html</button>
    <button @click="insertHTML('<b>哈哈哈哈哈</b>')"></button>
  </div>
</template>

<script>
import { ref } from 'vue';

export default {
  setup() {
    const editor = ref();
    const changeData = ()=>{
      // editor.value.setData('<i>1111111<i>')
        test11111.value = '<i>1111111<i>'
    }
    const getData= ()=>{
      console.log(test11111.value)
      localStorage.setItem('test11111',test11111.value)
    }
    const insertHTML = (e)=>{
      editor.value.insertHTML('<span style="color:red">55555<span>')
    }
    const test11111 = ref(localStorage.getItem('test11111')||'')
    return {
      editor,
      changeData,
      insertHTML,
      test11111,
      getData
    };
  },
};
</script>
